/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.femass.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity
@Table(name = "Participante")
@NamedQueries({
    @NamedQuery(name = "Participante.findAll", query = "SELECT p FROM Participante p"),
    @NamedQuery(name = "Participante.findByCod", query = "SELECT p FROM Participante p WHERE p.cod = :cod"),
    @NamedQuery(name = "Participante.findByNome", query = "SELECT p FROM Participante p WHERE p.nome = :nome"),
    @NamedQuery(name = "Participante.findByNumInscricao", query = "SELECT p FROM Participante p WHERE p.numInscricao = :numInscricao"),
    @NamedQuery(name = "Participante.findBySituacao", query = "SELECT p FROM Participante p WHERE p.situacao = :situacao"),
    @NamedQuery(name = "Participante.findBySenha", query = "SELECT p FROM Participante p WHERE p.senha = :senha"),
    @NamedQuery(name = "Participante.findByCpf", query = "SELECT p FROM Participante p WHERE p.cpf = :cpf")})
public class Participante implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "situacao")
    private char situacao;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod")
    private Integer cod;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @NotNull
    @Column(name = "num_inscricao")
    private int numInscricao;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "senha")
    private String senha;
    @Size(max = 45)
    @Column(name = "CPF")
    private String cpf;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "participante")
    private Aluno aluno;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "participante")
    private List<Inscricao> inscricaoList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "participante")
    private Palestrante palestrante;

    public Participante() {
    }

    public Participante(Integer cod) {
        this.cod = cod;
    }

    public Participante(Integer cod, String nome, int numInscricao, char situacao, String senha) {
        this.cod = cod;
        this.nome = nome;
        this.numInscricao = numInscricao;
        this.situacao = situacao;
        this.senha = senha;
    }

    public Integer getCod() {
        return cod;
    }

    public void setCod(Integer cod) {
        this.cod = cod;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public int getNumInscricao() {
        return numInscricao;
    }

    public void setNumInscricao(int numInscricao) {
        this.numInscricao = numInscricao;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public Aluno getAluno() {
        return aluno;
    }

    public void setAluno(Aluno aluno) {
        this.aluno = aluno;
    }

    public List<Inscricao> getInscricaoList() {
        return inscricaoList;
    }

    public void setInscricaoList(List<Inscricao> inscricaoList) {
        this.inscricaoList = inscricaoList;
    }

    public Palestrante getPalestrante() {
        return palestrante;
    }

    public void setPalestrante(Palestrante palestrante) {
        this.palestrante = palestrante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cod != null ? cod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Participante)) {
            return false;
        }
        Participante other = (Participante) object;
        if ((this.cod == null && other.cod != null) || (this.cod != null && !this.cod.equals(other.cod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.femass.model.Participante[ cod=" + cod + " ]";
    }

    public char getSituacao() {
        return situacao;
    }

    public void setSituacao(char situacao) {
        this.situacao = situacao;
    }

}
